<?php include('header.php')	?>

<?php
	$data = $MyPlurk->GetOwnProfile();
	$my_uid = $data['user_info']['uid'];
	
	$plurk_id = $_REQUEST['plurk_id'];
	$status = $_REQUEST['status'];
	if($plurk_id != '' && $status != '')
		$MyPlurk->PostResponse($plurk_id, $status);
?>

<?php
	$data = $MyPlurk->GetPlurk($_REQUEST['plurkID']);
	$author = $data['user'];	
	if($author['id'] == $my_uid) {
		$author_class = 'plurk-response_by_me';
	} else {
		$author_class = 'plurk-response_by_owner';
	}
	
	$plurk = $data['plurk'];
	if($plurk['qualifier_translated'] != '') {
		$qualifier = $plurk['qualifier_translated'];
	} else {
		$qualifier = $plurk['qualifier'];
	}
		
	$content = '<span class="qualifier">'.$qualifier.'</span>'.$plurk['content'];	
	print "<div class='plurk ".$author_class."'><img src='".$MyPlurk->GetAvatar($author['id'], $author['avatar'])."' /> <a href='index.php?user_id=".$author['id']."'><strong>".$author['display_name']."</strong></a> ".$content."</div>";	
	$author_class = ''; // reset
	
	$data = $MyPlurk->GetResponses($_REQUEST['plurkID']);
	foreach ($data['responses'] as $response) {
		$user_id = $response['user_id'];
		$avatar = $MyPlurk->GetAvatar($user_id, $data['friends'][$user_id]['avatar']);
		$display_name = $data['friends'][$user_id]['display_name'];
		$nick_name = $data['friends'][$user_id]['nick_name'];
		if($response['qualifier_translated'] != '') {
			$qualifier = $response['qualifier_translated'];
		} else {
			$qualifier = $response['qualifier'];
		}
		
		if($response['user_id'] == $author['id']) {
			$author_class = 'plurk-response_by_owner';
		}
		if($response['user_id'] == $my_uid) {
			$author_class = 'plurk-response_by_me';
		}
			
		$content = '<span class="qualifier">'.$qualifier.'</span>'.$response['content'];
		print "<div class='plurk ".$author_class."'><img src='".$avatar."' class='plurk_avatar' /> <a href='index.php?user_id=".$user_id."'><strong>".$display_name."</strong></a>".$content." <a href='get_responses.php?plurkID=".$_REQUEST['plurkID']."&replyto=".$nick_name."'>(reply)</a></div>";
		$author_class = ''; // reset
	}
	
	include('form_status.php');	
?>

<?php include('footer.php') ?>